
public class LabOne {

	public static void main(String[] args) {
		int[] table=new int[6];
		for(int i=0;i<6;i++)
			table[i]=i;
		System.out.println(isSorted(table));
		
		A[] table1=new A[5];
		for(int i=0;i<5;i++)
		   table1[i]=new A(i);
		
		table1[2]=new A(10);
		System.out.println(isSorted1(table1));
		reverseArray(table);
		for(int i=0;i<6;i++)
			   System.out.println(table[i]);
		
		System.out.println(gc(90,15));
		System.out.println(gc3(90,15,20));
	}
    
	public static boolean isSorted(int[] table){
		
		for(int i=1;i<table.length;i++){
			if(table[i-1]>table[i])
				return false;
		}
		
		return true;
		
	}
	
	public static boolean isSorted1(Comparable[] table){
		
		for(int i=1;i<table.length;i++){
			if(table[i-1].compareTo(table[i])==1)
				return false;
		}
		
		
		
		return true;
		
		
	}
	
	
    public static int[] reverseArray(int[] arry){
    	
    	if(arry.length%2==0){
    		for(int i=0;i<=((arry.length/2)-1);i++){
    			int temp=arry[arry.length-1-i];
    			arry[arry.length-1-i]=arry[i];
    			arry[i]=temp;
    			
    		}
    	}
    	else{
    		int i=0;
    		while(i!=(arry.length-1)/2){
    			int temp=arry[arry.length-1-i];
    			arry[arry.length-1-i]=arry[i];
    			arry[i]=temp;
    			i++;
    		}
    	}
		
    	
    	
    	
    	return arry;
    	
    }
	public static int gc(int a,int b){
		
		if(a<b){
			int temp=a;
			a=b;
			b=temp;
		}
		if(a%b!=0){
			return gc(b,a%b);
		}else{
			return b;
		}
		
		
		
		
	}
	
	public static int gc3(int a,int b,int c){
		return gc(gc(a,b),c);
	}
}
class A<E> implements Comparable<E>{

	int num;
	
	public A(int num){
		this.num=num;
	}
	public int compareTo(E o) {
		A O=(A)o;
		if(O.num>this.num)
			return -1;
		else if(O.num==this.num)
			return 0;
		else
			return 1;
	}
	
}
